//---------------------------------------------------------------------------- // File: Image.h // Type: Image File management. // Author: Ken Anderson // Date: 6/22/3 // OS dependant: N/A // // Notes: This header contains several image definitions that can be shared // amoung other image file types. This header also supports Image.cpp // for image transformations. // Versions: // 1.0 -- Init. // // Required headers: // 1) Common.h -- Used to access common indentifiers, definitions & typedefs. // //---------------------------------------------------------------------------- #ifndef _IMAGE_MX_ #define _IMAGE_MX_ #include "Common.h" //-----------------------Image Error codes-------------------------------------// typedef ECTYPE IM_ERROR; #define IME_NO4BIT (0x01 + ECERR_BASECOUNT) //Does not support 16 colors, 4-bit images. #define IME_NO2BIT (0x02 + ECERR_BASECOUNT) //Does not support 4 colors, 2-bit images. #define IME_NO1BIT (0x03 + ECERR_BASECOUNT) //Does not support 1 color, monochrome images. #define IME_NORLE (0x04 + ECERR_BASECOUNT) //Does not support RLE(Run Length) compression. #define IME_CORRUPTIMG (0x05 + ECERR_BASECOUNT) //The image was corrupted. #define IME_NULLIMAGE (0x06 + ECERR_BASECOUNT) //The image was empty & could not be read. #define IME_NOTANIMAGE (0x07 + ECERR_BASECOUNT) //Media used was not an image. #define IME_BITNS (0x08 + ECERR_BASECOUNT) //Color depth is not supported. //---------------------Color Depth Definitions---------------------------------// typedef Word IMFORMAT_BD; #define IMFORMAT_BD1 0x0001 //1-bit color depth format. #define IMFORMAT_BD4 0x0004 //4-bit color depth format. #define IMFORMAT_BD8 0x0008 //8-bit color depth format. #define IMFORMAT_BD8SC 0x000A //8-bit single channel color depth format. #define IMFORMAT_BD16 0x0010 //16-bit color depth format. #define IMFORMAT_BD24 0x0018 //24-Bit color depth format. #define IMFORMAT_BD32 0x0020 //32-Bit color depth format. //------------------------Method Definitions----------------------------------// typedef Byte IM_METHOD; #define IMMETHOD_PIXEL 0x00 //Pixel transformations #define IMMETHOD_BILINEAR 0x01 //Bilinear transformations. #define IMMETHOD_BICUBIC 0x02 //Bicubic transformations. //----------------------Color Formats-----------------------------// //32-bit RGB color scheme & can also be used for palette indexes in 8-bit images. typedef struct tgCOLOR_ARGB { Byte blue; Byte green; Byte red; Byte alpha; } ColorARGB, CARGB, Color4, C4; //24-bit RGB Color scheme. typedef struct tgCOLOR_RGB { Byte blue; Byte green; Byte red; } ColorRGB, Color3, C3; typedef struct tgCOLOR_RGB555 { Byte blue:5; Byte green:5; Byte red:5; } ColorRGB555, CRGB555, RGB555; //----------------------IMAGECORE-----------------------------// //This structure is used for all images with common properties //required for transformations. typedef struct tgCOMPACT_IMAGE { long Width; long Height; long WidthBytes; Word BitCount; void* vpBits; } CompactImage, *PCompactImage, CIMG, *PCIMG, **HCIMG; //Image Functions IM_ERROR MergeRGBImage(HCIMG hci, HCIMG hci2, long xOffset, long yOffset, bool bClip, Color4 ClipColor, float fAlpha, float fAlpha2); IM_ERROR ShadowRGBImage(HCIMG hci, HCIMG hci2, long xOffset, long yOffset, bool bClip, Color4 ClipColor, float fShadow); IM_ERROR StretchRGBImage(HCIMG hci, long lWidth, long lHeight); IM_ERROR StretchRGBImageSampling(HCIMG hci, long lWidth, long lHeight, int nSamplingRate, bool bClip, Color4 ClipColor); IM_ERROR InvertRGBImage(HCIMG hci, bool bClip, Color4 ClipColor); IM_ERROR ReverseRGBImage(HCIMG hci, bool bClip, Color4 ClipColor); ////////////////////////////// // ASM INTEL FUNCTIONS // ////////////////////////////// int ASM_INTEL_CalculatePaddedBytes(long Width, int pixelsize=1, int boundry=4); ////////////////////////////// // C COUNTERPART FUNCTIONS // ////////////////////////////// //C FUNCTIONS THAT HAVE ASM COUNTERPARTS int C_CalculatePaddedBytes(long Width, int pixelsize=1, int boundry=4); bool IsClipColor(Byte* byPixel, Color4 ClipColor); ////////////////////////////// // REDEFINITIONS // ////////////////////////////// #ifdef INTEL_ASM #define CalculatePaddedBytes ASM_INTEL_CalculatePaddedBytes #else #define CalculatePaddedBytes C_CalculatePaddedBytes #endif #endif